﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Timers;

namespace NSServer
{
    class Server
    {
        static void Main(string[] args)
        {
            // timer a GC-hez
            Timer aTimer = new System.Timers.Timer(200);

            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            aTimer.Interval = 200;
            aTimer.Enabled = true;

            Data.adatfelolvasas();

            ServiceHost host = new ServiceHost(typeof(PemsService));
            host.Open();
            foreach (ServiceEndpoint e in host.Description.Endpoints)
            {
                Console.WriteLine("{0} ({1})", e.Address.ToString(), e.Binding.Name);
            }
            Console.WriteLine("A szolgaltatas fut (Enter: stop)");
            Console.ReadLine();

            
            Data.adatKiiras();
        }

        private static void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            GC.Collect();
        }
    }

   
}
